package 每日一题;

import java.util.Arrays;

/**
 * @author chenhong
 * @version 1.0
 * @description TODO
 * @date 2023/5/5 16:11
 */
public class L2432 {
    public int hardestWorker(int n, int[][] logs) {
        int ans = logs[0][0];
        int maxTime = logs[0][1];
        for (int i = 1; i < logs.length; i++) {
            if(logs[i][1] - logs[i - 1][1] > maxTime){
                maxTime = logs[i][1] - logs[i - 1][1];
                ans = logs[i][0];
            }else if(logs[i][1] - logs[i - 1][1] == maxTime && ans > logs[i][0]){
                ans = logs[i][0];
            }
        }
        return ans;
    }
}
